var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/businessComponent/work-flow/WFApprovalPoints.tsx
var WFApprovalPoints_exports = {};
__export(WFApprovalPoints_exports, {
  WFApprovalPoints: () => WFApprovalPoints
});
module.exports = __toCommonJS(WFApprovalPoints_exports);
var import_antd = require("antd");
var import_react = require("react");
var import_baseComponent = require("../../baseComponent");
var import_functionalComponent = require("../../functionalComponent");
var import_util = require("../../util");
function WFApprovalPoints(props) {
  const mCtx = (0, import_react.useContext)(import_functionalComponent.ModalContext);
  const { approvalPointsData, statisticsApprovalPoint, callBack, cancelBack, view } = props;
  const [data, setData] = (0, import_react.useState)(import_util.iup.deepCopy(approvalPointsData));
  const riskeLevelListInit = ["无风险", "低", "中", "高"];
  const onDetailsChange = (record, index) => {
    let newData = import_util.iup.deepCopy(data);
    newData[index].riskLevel = record ? record.value : "";
    newData[index].optionValue = record ? record.label : "";
    setData(newData);
  };
  (0, import_react.useEffect)(() => {
    mCtx.ins.setApi({
      invokeOkHandler: async () => {
        var _a;
        if (!view) {
          const requiredState = data.some((i) => !i.riskLevel);
          if (requiredState) {
            import_util.iup.alert("请选择必填项");
            return;
          } else {
            await (callBack == null ? void 0 : callBack(data));
          }
        }
        (_a = mCtx.ins) == null ? void 0 : _a.destroy();
      },
      invokeCancelHandler: async () => {
        var _a;
        if (!view) {
          await (cancelBack == null ? void 0 : cancelBack());
        }
        (_a = mCtx.ins) == null ? void 0 : _a.destroy();
      }
    });
  }, [data]);
  return /* @__PURE__ */ React.createElement(import_util.Layout, { style: { padding: "5px 12px" } }, data.length > 0 ? data.map((i, index) => /* @__PURE__ */ React.createElement(import_util.Layout.Flex, { key: i.id, style: { paddingTop: "10px" } }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("span", null, index + 1, "."), /* @__PURE__ */ React.createElement("span", { style: { fontSize: "14px" } }, i.name)), /* @__PURE__ */ React.createElement("div", { style: { fontSize: "14px", margin: "10px 0 15px 10px" } }, /* @__PURE__ */ React.createElement("span", null, i.description)), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
    "span",
    {
      style: {
        marginRight: "4px",
        color: "#f5222d",
        fontSize: "14px"
      }
    },
    "*"
  ), /* @__PURE__ */ React.createElement(
    import_baseComponent.Select,
    {
      defaultValue: i.inspectType !== 1 ? i.details[0].riskLevel : null,
      disabled: i.inspectType !== 1 || !!view,
      style: { width: "140px" },
      options: i.details.map((j) => ({ value: j.riskLevel, label: j.optionValue })),
      onChange: (value) => {
        onDetailsChange(value, index);
      },
      placeholder: "请选择"
    }
  ), /* @__PURE__ */ React.createElement(
    import_antd.Input,
    {
      disabled: true,
      value: i.inspectType !== 1 ? i.details[0].riskLevel : riskeLevelListInit[data[index].riskLevel - 1],
      placeholder: "显示风险等级",
      style: { width: "150px", margin: "0 10px" }
    }
  ), i.riskLevel !== 1 && /* @__PURE__ */ React.createElement(
    import_antd.Input,
    {
      defaultValue: i.inspectType !== 1 ? i.details[0].remark : "",
      disabled: i.inspectType !== 1 || !!view,
      style: { width: "320px" },
      maxLength: 200,
      onChange: (e) => {
        let newData = import_util.iup.deepCopy(data);
        newData[index].remark = e.target.value;
        setData(newData);
      }
    }
  )))) : "", statisticsApprovalPoint && /* @__PURE__ */ React.createElement("div", { style: { marginTop: "50px" } }, /* @__PURE__ */ React.createElement("label", null, "审批要点统计"), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("span", { style: { color: "#red" } }, "高", /* @__PURE__ */ React.createElement("span", { style: { color: "#000000", padding: "0 10px" } }, statisticsApprovalPoint.highRisk)), /* @__PURE__ */ React.createElement("span", { style: { color: "#FE890C" } }, "中", /* @__PURE__ */ React.createElement("span", { style: { color: "#000000", padding: "0 10px" } }, statisticsApprovalPoint.mediumRisk)), /* @__PURE__ */ React.createElement("span", { style: { color: "#0081CC" } }, "低", /* @__PURE__ */ React.createElement("span", { style: { color: "#000000", padding: "0 10px" } }, statisticsApprovalPoint.lowRisk)), /* @__PURE__ */ React.createElement("span", { style: { color: "#00CC33" } }, "无风险", /* @__PURE__ */ React.createElement("span", { style: { color: "#000000", padding: "0 10px" } }, statisticsApprovalPoint.riskFree)))));
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  WFApprovalPoints
});
